#include <cmath>


#include "MathManiac.h"

vector3_t operator +(vector3_t& a, vector3_t& b)
{
	vector3_t c;
	c.x = a.x + b.x;
	c.y = a.y + b.y;
	c.z = a.z + b.z;

	return c;
}


vector3_t operator -(vector3_t& a, vector3_t& b)
{
	vector3_t c;
	c.x = a.x - b.x;
	c.y = a.y - b.y;
	c.z = a.z - b.z;

	return c;
}


vector3_t operator *(vector3_t& a, float b)
{
	vector3_t c;
	c.x = a.x * b;
	c.y = a.y * b;
	c.z = a.z * b;

	return c;
}


vector3_t operator *(vector3_t& a, vector3_t& b)
{
	vector3_t c;
	c.x = a.y * b.z - a.z * b.y;
	c.y = a.z * b.x - a.z * b.x;
	c.z = a.x * b.y - a.y * b.x;

	return c;
}




void normalize(vector3_t *v)
{
	float V = sqrt(v->x * v->x + v->y * v->y + v->z * v->z);
	v->x/=V;
	v->y/=V;
	v->z/=V;

}


void operator *=(plane_t& p, float f)
{
	p.a*=f;
	p.b*=f;
	p.c*=f;
	p.d*=f;
}

